<template>
  <div style="padding: 20px">
    <div class="headerBoxList">
      <svg
        width="24"
        height="24"
        viewBox="0 0 48 48"
        fill="none"
        xmlns="http://www.w3.org/2000/svg"
      >
        <path
          d="M18 6H8C6.89543 6 6 6.89543 6 8V18C6 19.1046 6.89543 20 8 20H18C19.1046 20 20 19.1046 20 18V8C20 6.89543 19.1046 6 18 6Z"
          fill="none"
          stroke="#333"
          stroke-width="4"
          stroke-linejoin="round"
        />
        <path
          d="M18 28H8C6.89543 28 6 28.8954 6 30V40C6 41.1046 6.89543 42 8 42H18C19.1046 42 20 41.1046 20 40V30C20 28.8954 19.1046 28 18 28Z"
          fill="none"
          stroke="#333"
          stroke-width="4"
          stroke-linejoin="round"
        />
        <path
          d="M40 6H30C28.8954 6 28 6.89543 28 8V18C28 19.1046 28.8954 20 30 20H40C41.1046 20 42 19.1046 42 18V8C42 6.89543 41.1046 6 40 6Z"
          fill="none"
          stroke="#333"
          stroke-width="4"
          stroke-linejoin="round"
        />
        <path
          d="M40 28H30C28.8954 28 28 28.8954 28 30V40C28 41.1046 28.8954 42 30 42H40C41.1046 42 42 41.1046 42 40V30C42 28.8954 41.1046 28 40 28Z"
          fill="none"
          stroke="#333"
          stroke-width="4"
          stroke-linejoin="round"
        />
      </svg>
      <span style="margin-left: 10px"
        >应用信息
        <span style="font-size: 15px" v-if="total !== 0"
          >({{ total }}行)</span
        ></span
      >
    </div>
    <div class="content">
      <!-- <p style="border-bottom: 1px solid #ebebeb;" v-for="(item,index) in list" :key="index">· {{ item }}</p> -->
      <el-table :data="list" border class="tableCCCC" height="100%" style="width: 100%">
        <el-table-column prop="name" label="名称"> </el-table-column>
        <el-table-column prop="package_name" label="包名"> </el-table-column>
        <el-table-column prop="firstInstallTime" label="安装时间" width="180">
        </el-table-column>
        <el-table-column prop="lastUpdateTime" label="最后一次更新时间" width="180">
        </el-table-column>
        <el-table-column prop="path" label="路径"> </el-table-column>
        <el-table-column prop="size" label="大小(byte)" width="180"> </el-table-column>
        <el-table-column prop="versionName" label="版本号" width="180"> </el-table-column>
      </el-table>

    </div>
    <div class="block">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="offset"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="limit"
          layout="total, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
  </div>
  </div>
</template>
  
<script>
import { getPhoneBaseApplction } from "@/api/phoneInfo/index";

export default {
  name: "ApplicationInfo",
  data() {
    return {
      list: [],
      total: 0,
      api: "/tencent/contact_new",
      offset: 1,
      limit: 20,
    };
  },
  mounted() {
    this.init();

  },
  created() {
  },
  watch:{
  '$store.state.account.basePhone':function(){
    this.init();
  }
    },
  methods: {
    init() {
      let node = this.$route.params.nodeData.data;
      let dataJson = {
        proof_num: node.proof_num,
        offset: this.offset,
        limit: this.limit,
      };
      getPhoneBaseApplction(dataJson).then((res) => {
        if(res.data.length > 0){
          this.list = res.data;
          this.total = res.data[0].cnt;
        }else{
          this.list = [];
          this.total = 0;
        }
      });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.limit = val;
      this.init();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.offset = val;
      this.init();
    }
  },
};
</script>
  
<style scoped>
.boxBorder {
  height: 100px;
  width: 100px;
  border: 1px solid red;
  display: flex;
  align-items: center;
  margin: 0 auto;
  padding: 20px;
  font-size: 19px;
}
.headerBoxList {
  width: 100%;
  height: 50px;
  border-bottom: 1px solid #d2d2d2;
  display: flex;
  align-items: center;
  font-size: 18px;
  font-weight: bold;
}
.content {
  height: 90vh;
  overflow-y: auto;
  padding-left: 50px;
  margin-top: 20px;
}
.tableCCCC{
  height: 90vh;
}
@media screen and (min-width: 2360px) {
  .content {
    height: 67vh;
    overflow-y: auto;
  }
  .tableCCCC{
  height: 67vh;
}
}
</style>